using ZR.Model.Enums;

namespace ZR.Model.BaseFrame.Dto
{
    /// <summary>
    /// 公司表单对象
    /// </summary>
    public class CompanyFormDtoBase
    {      
        /// <summary>
        /// 公司标识
        /// </summary>
        [Required(ErrorMessage = "公司标识不能为空")]
        public long CompanyId { get; set; }
        
        /// <summary>
        /// 上级公司
        /// </summary>
        [Required(ErrorMessage = "上级公司不能为空")]
        public long PaCompanyId { get; set; }
        
        /// <summary>
        /// 公司名
        /// </summary>
        [Required(ErrorMessage = "公司名不能为空")]
        public string CompanyName { get; set; }
        
        /// <summary>
        /// 公司简称
        /// </summary>
        [Required(ErrorMessage = "公司简称不能为空")]
        public string CompanyAbbr { get; set; }
        
        /// <summary>
        /// 公司编号
        /// </summary>
        [Required(ErrorMessage = "公司编号不能为空")]
        public string CompanyNo { get; set; }
        
        /// <summary>
        /// 所属行业
        /// </summary>
        public string BelongIndustry { get; set; }
        
        /// <summary>
        /// 负责人
        /// </summary>
        public string Manager { get; set; }
        
        /// <summary>
        /// 电话
        /// </summary>
        public string Tel { get; set; }
        
        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; set; }
        
        /// <summary>
        /// 传真
        /// </summary>
        public string Fax { get; set; }
        
        /// <summary>
        /// 地址
        /// </summary>
        public string Addr { get; set; }
        
        /// <summary>
        /// 邮编
        /// </summary>
        public string Zip { get; set; }
        
        /// <summary>
        /// 公司网址
        /// </summary>
        public string CompanyUrl { get; set; }
        
        /// <summary>
        /// 成立时间
        /// </summary>
        public DateTime? SetTime { get; set; }
        
        /// <summary>
        /// 经营范围
        /// </summary>
        public string Runscope { get; set; }
        
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        
        /// <summary>
        /// 状态
        /// </summary>
        [Required(ErrorMessage = "状态不能为空")]
        public string StateCode { get; set; }
        

    }

    /// <summary>
    /// 删除公司请求对象
    /// </summary>
    public class DeleteCompanyReqBase
    {
        /// <summary>
        /// 标识集合
        /// </summary>
        public string Ids { get; set; }
    }

    /// <summary>
    /// 变更公司状态请求对象
    /// </summary>
    public class ChangeCompanyStateReqBase
    {
        /// <summary>
        /// 标识
        /// </summary>
        public long Id { get; set; }
        
        /// <summary>
        /// 状态编码
        /// </summary>
        public string StateCode { get; set; }
        
        /// <summary>
        /// 状态枚举
        /// </summary>
        [JsonIgnore]
        public DataStateEnum? StateEnum
        {
            get
            {
                DataStateEnum stateEnum;
                var isOk = Enum.TryParse(StateCode, true, out stateEnum);
                if (isOk && Enum.IsDefined(stateEnum))
                {
                    return stateEnum;
                }
                return null;
            }
        }
    }

    /// <summary>
    /// 获取公司树选择列表请求对象
    /// </summary>
    public class GetCompanyTreeSelectListReqBase:GetTreeSelectListReqBase
    {
    }

    /// <summary>
    /// 获取公司分页列表请求对象
    /// </summary>
    public class GetCompanyPageListReqBase : PagerInfo 
    {
        /// <summary>
        /// 树结点标识
        /// </summary>
        public long? TreeNodeId { get; set; }
        /// <summary>
        /// 是否是默认结点类型
        /// </summary>
        public bool IsDefaultNodeType { get; set; }=true;

        /// <summary>
        /// 关键词
        /// </summary>
        public string Keywords { get; set; }

        /// <summary>
        /// 起始成立时间
        /// </summary>
        public DateTime? BeginSetTime{get; set; }
        /// <summary>
        /// 终止成立时间
        /// </summary>
        public DateTime? EndSetTime{get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public string StateCode { get; set; }


    }

    /// <summary>
    /// 公司列表项
    /// </summary>
    public class CompanyListItemDtoBase
    {
        /// <summary>
        /// 公司标识
        /// </summary>
        public long CompanyId { get; set; }
        
        /// <summary>
        /// 上级公司
        /// </summary>
        public long PaCompanyId { get; set; }
        
        public string PaCompanyName { get; set; }
        /// <summary>
        /// 公司名
        /// </summary>
        public string CompanyName { get; set; }
        
        /// <summary>
        /// 公司简称
        /// </summary>
        public string CompanyAbbr { get; set; }
        
        /// <summary>
        /// 公司编号
        /// </summary>
        public string CompanyNo { get; set; }
        
        /// <summary>
        /// 成立时间
        /// </summary>
        public DateTime? SetTime { get; set; }
        
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }
        
        /// <summary>
        /// 创建人
        /// </summary>
        public string Creater { get; set; }
        
        /// <summary>
        /// 状态
        /// </summary>
        public string StateCode { get; set; }
        
    }

    /// <summary>
    /// 公司详情
    /// </summary>
    public class CompanyDetailDtoBase: CompanyFormDto
    {

    }
}